package foo;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

public class NIOServer {
	private ServerSocketChannel	serverChannel;
	private final boolean		isRunning	= true;

	public void init() throws IOException {
		serverChannel = ServerSocketChannel.open();
		serverChannel.configureBlocking(true);
		serverChannel.socket().bind(new InetSocketAddress(8080));
	}

	public void run() {
		while (isRunning) {
			try {
				SocketChannel socketChannel = serverChannel.accept();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
